package cn.aitstone.controller;

import cn.aitstone.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
/**
 * @Description: 订单接口
 * @Author: Sheldon
 * @Version: 1.0
 * @Date:  2022/7/27 22:14
 */
@RestController
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/getByUserId/{id}")
    public User getByUserId(@PathVariable Long id){
        String url = "http://localhost:1020/user/" + id;

        return restTemplate.getForObject(url, User.class);

    }

}
